/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cz.muni.fi.pa165.machineryrental.restclient;

/**
 *
 * @author jostri
 */
public class RESTSettings extends javax.swing.JPanel {

	/**
	 * Creates new form RESTSettings
	 */
	public RESTSettings() {
		initComponents();
	}

	/**
	 * This method is called from within the constructor to initialize the form.
	 * WARNING: Do NOT modify this code. The content of this method is always
	 * regenerated by the Form Editor.
	 */
	@SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        serverUriLabel = new javax.swing.JLabel();
        serverUriTextField = new javax.swing.JTextField();
        usernameLbl = new javax.swing.JLabel();
        usernameTB = new javax.swing.JTextField();
        passwordLBL = new javax.swing.JLabel();
        passwordTB = new javax.swing.JPasswordField();

        serverUriLabel.setLabelFor(serverUriLabel);
        serverUriLabel.setText("Server URI:");

        serverUriTextField.setText("http://localhost:8080/pa165/");
        serverUriTextField.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                serverUriTextFieldKeyPressed(evt);
            }
            public void keyReleased(java.awt.event.KeyEvent evt) {
                serverUriTextFieldKeyReleased(evt);
            }
            public void keyTyped(java.awt.event.KeyEvent evt) {
                serverUriTextFieldKeyTyped(evt);
            }
        });

        usernameLbl.setText("Username:");

        usernameTB.setText("admin");
        usernameTB.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                usernameTBKeyPressed(evt);
            }
            public void keyReleased(java.awt.event.KeyEvent evt) {
                usernameTBKeyReleased(evt);
            }
            public void keyTyped(java.awt.event.KeyEvent evt) {
                usernameTBKeyTyped(evt);
            }
        });

        passwordLBL.setText("Password:");

        passwordTB.setText("pa165");
        passwordTB.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                passwordTBKeyPressed(evt);
            }
            public void keyReleased(java.awt.event.KeyEvent evt) {
                passwordTBKeyReleased(evt);
            }
            public void keyTyped(java.awt.event.KeyEvent evt) {
                passwordTBKeyTyped(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(27, 27, 27)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(passwordTB)
                    .addComponent(passwordLBL)
                    .addComponent(serverUriLabel)
                    .addComponent(serverUriTextField, javax.swing.GroupLayout.DEFAULT_SIZE, 642, Short.MAX_VALUE)
                    .addComponent(usernameLbl)
                    .addComponent(usernameTB))
                .addGap(25, 25, 25))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(serverUriLabel)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(serverUriTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(usernameLbl)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(usernameTB, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(passwordLBL)
                .addGap(13, 13, 13)
                .addComponent(passwordTB, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(32, Short.MAX_VALUE))
        );

        serverUriLabel.getAccessibleContext().setAccessibleName("serverUriLabel");
        serverUriTextField.getAccessibleContext().setAccessibleName("serverUriTF");
    }// </editor-fold>//GEN-END:initComponents

    private void serverUriTextFieldKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_serverUriTextFieldKeyPressed
        App.setUrl(this.serverUriTextField.getText());
    }//GEN-LAST:event_serverUriTextFieldKeyPressed

    private void serverUriTextFieldKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_serverUriTextFieldKeyTyped
        App.setUrl(this.serverUriTextField.getText());
    }//GEN-LAST:event_serverUriTextFieldKeyTyped

    private void serverUriTextFieldKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_serverUriTextFieldKeyReleased
        App.setUrl(this.serverUriTextField.getText());
    }//GEN-LAST:event_serverUriTextFieldKeyReleased

    private void usernameTBKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_usernameTBKeyPressed
        App.setUsername(this.usernameTB.getText());
    }//GEN-LAST:event_usernameTBKeyPressed

    private void usernameTBKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_usernameTBKeyReleased
        App.setUsername(this.usernameTB.getText());
    }//GEN-LAST:event_usernameTBKeyReleased

    private void usernameTBKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_usernameTBKeyTyped
        App.setUsername(this.usernameTB.getText());
    }//GEN-LAST:event_usernameTBKeyTyped

    private void passwordTBKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_passwordTBKeyPressed
        App.setPassword(new String(this.passwordTB.getPassword(), 0, this.passwordTB.getPassword().length));
    }//GEN-LAST:event_passwordTBKeyPressed

    private void passwordTBKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_passwordTBKeyReleased
        App.setPassword(new String(this.passwordTB.getPassword(), 0, this.passwordTB.getPassword().length));
    }//GEN-LAST:event_passwordTBKeyReleased

    private void passwordTBKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_passwordTBKeyTyped
        App.setPassword(new String(this.passwordTB.getPassword(), 0, this.passwordTB.getPassword().length));
    }//GEN-LAST:event_passwordTBKeyTyped

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel passwordLBL;
    private javax.swing.JPasswordField passwordTB;
    private javax.swing.JLabel serverUriLabel;
    private javax.swing.JTextField serverUriTextField;
    private javax.swing.JLabel usernameLbl;
    private javax.swing.JTextField usernameTB;
    // End of variables declaration//GEN-END:variables
}
